package com.example.my_self_view.init

import android.view.LayoutInflater
import android.view.ViewGroup
import com.example.my_self_view.databinding.ItemButtonBinding

class ButtonAdapter: BaseAdapter<Pair<String, () -> Unit>, ItemButtonBinding>() {
    override fun getVB(inflater: LayoutInflater, parent: ViewGroup): ItemButtonBinding {
        return ItemButtonBinding.inflate(inflater, parent, false)
    }

    override fun addEventListener(holder: Holder) {

    }

    override fun onBindHolder(holder: Holder, position: Int) {
        getData(position).let { pair ->
            holder.mBinding.btn.apply {
                text = pair.first
                setOnClickListener {pair.second.invoke()}
            }
        }
    }
}